package com.zsj.juc.thread;

/**
 * @author <a href="https://gitee.com/zhengshengjun">zsj</a>
 * @date 2023/12/4.
 */
public class Test {

    public static void main(String[] args) {
        Thread aa = new Thread(() -> {
            System.out.println(Thread.currentThread().getName()
                    +":"+Thread.currentThread().isAlive());
            System.out.println(Thread.currentThread().getName()
                    +":"+Thread.currentThread().isDaemon());
            while (true) {

            }
        }, "aa");
        //设置守护线程 如果用户线程没有了 守护线程会自动死亡 因为jvm会自动关闭
        aa.setDaemon(true);
        aa.start();
        System.out.println(Thread.currentThread().getName()+"overs");
    }

}
